// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false


import hljs from 'highlight.js'
import 'highlight.js/styles/github.css'
import './common/style/markdown.less'
import './common/style/common.less'
//import './common/style/waves.less'


Vue.directive('highlight', (el) => {
  let blocks = el.querySelectorAll('pre code');
  let h2Start = el.querySelectorAll('h2')[1];

  if(el.className.includes('home') && h2Start) {
    let isHide = false;
    h2Start.parentNode.childNodes.forEach((item => {
      if (!isHide && item === h2Start) {
        isHide = true;
      }
      if (isHide && item.style) {
        item.style.display="none";
      }
    }));
  }
  blocks.forEach((block) => {
    hljs.highlightBlock(block)
  })
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  beforeCreate: function () {
    console.log('beforeCreate');
  },
  created: function () {
    console.log('created');
  },
  components: {App},
  template: '<App/>'
})

